<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <script>

        // toString   把数据类型转化为字符串
        //    基本数据类型可以正常转字符串
        //    数组转字符串等同于 join方法
        //    对象转字符串  转不成功 -> object Object

        var a = 1 ;
        console.log(a.toString());    // '1'

        var b = true ;
        console.log(b.toString());  // 'true'

        var arr = [1,2,3] ;
        console.log(String(arr) === '1,2,3');   // 等同于join


        var obj = {a:1 , b:2} ;
        // console.log(obj.toString());   // [object Object]


        document.write(obj);


        const oDiv = document.getElementsByTagName('div');
        document.write(oDiv);

    </script>
    
</body>
</html>